if let Some(dir) = env::var_os("CARGO_TARGET_DIR") {
*self.target_dir.borrow_mut() = Some(Filesystem::new(self.cwd.join(dir)));
} else if let Some(val) = try!(self.get_path("build.target-dir")) {
- *self.target_dir.borrow_mut() = Some(Filesystem::new(val.val));
+ let val = self.cwd.join(val.val);
+ *self.target_dir.borrow_mut() = Some(Filesystem::new(val));
}
Ok(())
}
assert_that(p.cargo_process("build").arg("-v"),
execs().with_status(0));
});
+
+test!(custom_target_dir {
+ let p = project("foo")
+ .file("Cargo.toml", r#"
+ [project]
+ name = "foo"
+ version = "0.5.0"
+ authors = []
+
+ [dependencies]
+ a = { path = "a" }
+ "#)
+ .file("src/lib.rs", "")
+ .file(".cargo/config", r#"
+ [build]
+ target-dir = 'test'
+ "#)
+ .file("a/Cargo.toml", r#"
+ [project]
+ name = "a"
+ version = "0.5.0"
+ authors = []
+ build = "build.rs"
+ "#)
+ .file("a/build.rs", "fn main() {}")
+ .file("a/src/lib.rs", "");
+
+ assert_that(p.cargo_process("build").arg("-v"),
+ execs().with_status(0));
+});